package com.qsd.TeacherSystem.dao;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qsd.common.pojo.PaperEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.qsd.common.po.Discussion;
import com.qsd.common.po.FullInTheBlank;
import com.qsd.common.po.Judgment;
import com.qsd.common.po.MultipleChoice;
import com.qsd.common.po.OneChoice;
import com.qsd.common.po.Paper;

@Mapper
public interface PaperDao extends BaseMapper<PaperEntity> {

	List<Paper> queryByCourseId(Integer courseId);
	List<Paper> queryAllByUsername(String username);
	Paper queryById(Integer id);
	int save(Paper paper);
	int update(Paper paper);
	List<OneChoice> queryOneChoicesByPaperId(Integer id);
	List<MultipleChoice> queryMultipleChoicesByPaperId(Integer id);
	List<Judgment> queryJudgmentsByPaperId(Integer id);
	List<FullInTheBlank> queryFullInTheBlanksByPaperId(Integer id);
	List<Discussion> queryDiscussionsByPaperId(Integer id);
	int deleteByName(@Param("name")String name, @Param("id")Integer id);
	int addOneChoice(OneChoice oneChoice);
	int addMultipleChoice(MultipleChoice multipleChoice);
	int addJudgment(Judgment judgment);
	int addFullInTheBlank(FullInTheBlank fullInTheBlank);
	int addDiscussion(Discussion discussion);

    void deleteByPageId(String name, Integer id);

	/**
	 *
	 * @param id paperId
	 * @param degree degree
	 * @return
	 */
	List<OneChoice> findOneChoiceByRandom(@Param("param1") Integer id, @Param("param2") String degree);
	List<MultipleChoice> findMulChoiceByRandom(@Param("param1") Integer id, @Param("param2") String degree);
	List<Judgment> findJudFromDaoByRandom(@Param("param1") Integer id, @Param("param2") String degree);
	List<FullInTheBlank> findFullFromDaoByRandom(@Param("param1") Integer id, @Param("param2") String degree);
	List<Discussion> findDisFromDaoByRandom(@Param("param1") Integer id, @Param("param2") String degree);

	List<Paper> queryAllByUsername2(String username);
}
